<script lang="ts">
import { defineComponent } from 'vue';
import { useRouter } from 'vue-router';
import { User, Shop } from '@element-plus/icons-vue';

export default defineComponent({
  name: 'UserManagement',
  components: {
    User,
    Shop
  },
  setup() {
    const router = useRouter();

    const navigateTo = (path: string) => {
      router.push(path);
    };

    return {
      navigateTo
    };
  }
});
</script>

<template>
  <div class="dashboard-container">
    <h1 class="title">后台管理系统</h1>
    <div class="button-group">
      <el-card
          class="nav-card consumer-card"
          shadow="hover"
          @click="navigateTo('/admin/customers')"
      >
        <div class="card-content">
          <el-icon class="icon"><User /></el-icon>
          <h2>管理消费者</h2>
          <p>查看和编辑消费者账户信息</p>
        </div>
      </el-card>

      <el-card
          class="nav-card merchant-card"
          shadow="hover"
          @click="navigateTo('/admin/sellers')"
      >
        <div class="card-content">
          <el-icon class="icon"><Shop /></el-icon>
          <h2>管理商家</h2>
          <p>管理商家信息和审核状态</p>
        </div>
      </el-card>
    </div>
  </div>
</template>

<style scoped>
.dashboard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 2rem;
}

.title {
  color: #2c3e50;
  margin-bottom: 3rem;
  font-size: 2.5rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.button-group {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 900px;
}

.nav-card {
  width: 300px;
  height: 250px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
}

/* 使用Element Plus自带的hover效果并增强 */
.nav-card:hover {
  transform: translateY(-5px);
}

/* 消费者卡片特定样式 */
.consumer-card:hover {
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
}

.consumer-card .icon {
  color: #409eff;
}

/* 商家卡片特定样式 */
.merchant-card:hover {
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
}

.merchant-card .icon {
  color: #e6a23c;
}

.card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 1rem;
  text-align: center;
}

.icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.nav-card:hover .icon {
  transform: scale(1.1);
}

h2 {
  color: #2c3e50;
  margin-bottom: 0.8rem;
  font-size: 1.5rem;
}

p {
  color: #7f8c8d;
  margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .button-group {
    flex-direction: column;
    align-items: center;
  }

  .title {
    font-size: 2rem;
    margin-bottom: 2rem;
  }
}
</style>